import request from '@/utils/request'

// gateway 请求路径
const gatewayPrefix = '/cnoocDemo'

// 业务请求路径
const busiPrefix = '/BusiLeaveInfo'

// 查询列表
export function selectList(args) {
  return request({
    url: gatewayPrefix + busiPrefix + '/select',
    method: 'POST',
    data: args
  })
}

// 通过主键查询
export function selectById(id) {
  return request({
    url: gatewayPrefix + busiPrefix + '/' + id,
    method: 'GET',
    data: {}
  })
}

// 插入
export function insertRecord(args) {
  return request({
    url: gatewayPrefix + busiPrefix,
    method: 'POST',
    data: args
  })
}

// 更新
export function updateRecordById(id, args) {
  return request({
    url: gatewayPrefix + busiPrefix + '/' + id,
    method: 'PUT',
    data: args
  })
}

// 删除
export function deleteRecord(args) {
  return request({
    url: gatewayPrefix + busiPrefix,
    method: 'DELETE',
    data: args
  })
}

// 提交
export function doSubmitRecord(args) {
  return request({
    url: gatewayPrefix + busiPrefix + '/doSubmit',
    method: 'POST',
    data: args
  })
}

// 通过
export function doPassRecord(args) {
  return request({
    url: gatewayPrefix + busiPrefix + '/doPass?id=' + args.id,
    method: 'POST',
    data: args
  })
}

// 单据驳回
export function doRejectRecord(args) {
  return request({
    url: gatewayPrefix + busiPrefix + '/doReject?id=' + args.id,
    method: 'POST',
    data: args
  })
}

// 申请人撤回
export function applyWithdrawRecord(args) {
  return request({
    url: gatewayPrefix + busiPrefix + '/applyWithdraw?id=' + args.id + '&procInstanceId=' + args.procInstanceId,
    method: 'POST',
    data: args
  })
}

